<template>
  <el-dialog
    title="角色编辑"
    :visible.sync="state"
    width="30%"
    :before-close="handleClose"
  >
    <qf-form
      width="80px"
      :formConfig="formConfig"
      :formBtns="formBtns"
      @submit="submitFn"
    ></qf-form>
  </el-dialog>
</template>

<script>
export default {
  props: {
    state: {
      type: Boolean,
      default: false,
    },
  },

  data() {
    return {
      formConfig: [
        {
          label: "角色名",
          field: "role_name",
          type: "text",
          rules: [{ required: true, message: "角色名比填", trigger: "blur" }],
        },
        {
          label: "角色描述",
          field: "role_desc",
          type: "text",
          rules: [{ required: true, message: "角色描述比填", trigger: "blur" }],
        },
      ],

      formBtns: [
        {
          content: "更新",
          type: "primary",
        },
        {
          content: "重置",
          type: "",
        },
      ],
    };
  },
  methods: {
    handleClose() {
      this.$emit("close");
    },
    submitFn(formData) {
      console.log("更新数据处理", formData);
    },
  },
};
</script>

<style></style>
